<template>
	<view class="dologinpage">
		<button type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">手机号码一键登录</button>
	</view>
</template>

<script>
  import {mapState,mapMutations,mapActions} from 'vuex'

	export default {
		data() {
			return {
				
			}
		},
    computed:{
      ...mapState('m_path',['rePath'])
    },
		methods: {
      ...mapActions('m_user',['getUserInfo']),
			async getPhoneNumber(e){
        // console.log(e.detail.code)
      const res = await uni.$http.get('/user/userInfo',{code:e.detail.code})
      // console.log(res)
      this.$store.commit('m_user/setMobile',res.data.data.mobile)
      this.getUserInfo()
      if(this.rePath.type === 'switchTab') {
        uni.switchTab({
          url:this.rePath.url
        })
      }else {
        uni.navigateTo({
          url:this.rePath.url
        })
      }
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.dologinpage{
		width: 100%;
		height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>
